Dekoratives Banner

prompt() Global Function


    prompt(prompt, default)

Description

    The prompt global function opens a dialog box with a text field into which the user can enter a text string. The text string is returned as a value, or is null if the dialog is cancelled.

Parameters

    prompt

    text string which appears inthe prompt dialog

    default

    text string which appears by default in the text field

Returns

    String, or null if dialog is cancelled. Read-only.

Example

    // presuming a project loaded with at least one comp is open:
    var myCompItem = app.project.item(1);
    var newName = prompt( "What would you like to name the comp?"); // rename it
    if (newName) { //if the user cancels, newName is null
        myCompItem.name = newName; // newName now holds a string
    }